﻿
//生成[SystemParameter]Repository代码
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FineAdmin.IRepository;
using FineAdmin.Model;
using Dapper;

namespace FineAdmin.Repository
{
    public class SystemParameterRepository : BaseRepository<SystemParameterModel>, ISystemParameterRepository
    {
        public SystemParameterModel GetByCode(string Code)
        {
            using (var conn = SqlHelper.SqlConnection())
            {
                DynamicParameters Parameters = new DynamicParameters();
                Parameters.Add("Code", Code);
                string sql = @"SELECT  * FROM SystemParameter Where Code = @Code";
                return conn.QueryFirstOrDefault<SystemParameterModel>(sql, Parameters);
            }
        }

        public IEnumerable<SystemParameterModel> GetSystemParameterList()
        {
            using (var conn = SqlHelper.SqlConnection())
            {
                string sql = @"SELECT  * FROM SystemParameter ORDER BY SortCode ASC";
                return conn.Query<SystemParameterModel>(sql);
            }
        }

        
    }
}